package com.yoomiito.app.ui.order.list

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.yoomiito.app.R
import com.yoomiito.app.model.order.OrderGoods
import com.yoomiito.app.utils.ImageLoader
import com.yoomiito.app.utils.SpannableUtils
import com.yoomiito.app.widget.RoundImageView

class BaoPinOrderGoodsAdapter(data: List<OrderGoods>?) : BaseQuickAdapter<OrderGoods, BaseViewHolder>(R.layout.item_goods_7, data) {

    override fun convert(helper: BaseViewHolder, item: OrderGoods) {
        val imageView = helper.getView<RoundImageView>(R.id.goods_pic)
        ImageLoader.getInstance().into(imageView.context, item.item_picture, imageView, R.drawable.goods_default)

        helper.setText(R.id.goods_name, item.item_title)
        val price = "¥" + item.sale_price
        helper.setText(R.id.goods_price, SpannableUtils.handlePriceDecimal(price))
        helper.setText(R.id.goods_size, "x" + item.num)
        helper.setText(R.id.goods_date, item.ctime)
    }
}
